
import Vue from 'vue'
import App from './App'
import store from './store/'
import routerMap from './router'
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'
import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'


Vue.use(VueRouter)
Vue.use(VueResource)
Vue.use(MintUI)

Vue.http.options.emulateJSON = true
Vue.prototype.gettoken = function (){
    // console.log(this.$http,'111111111111')
    // this.$http.post("http://localhost:8080/cors/cors/CorsPost",{myName:"申玉超",myPwd:"123456"},{emulateJSON: true})
    // .then(
    //   (response)=>{
    //     console.log(response); 
    //   },
    //   (error)=>{
    //     console.log(error);
    //   }
    // );
}
// 并且配置路由规则
const router = new VueRouter({
    mode: 'hash',
    base: __dirname,
    routes: routerMap
})
// Vue.http.interceptors.push((request, next) => {
//         // var TOKEN = sessionStorage.getItem('accessToken')
//         var TOKEN = 'f6bf6596-8ccc-4940-85cd-689ef47a62b1'
//         if (TOKEN && request.method == 'POST') {
//             var obj = request.body
//             obj['access_token'] = TOKEN
//             request.body = obj
//         }
//     next((response) => {
//         return response
//     })
// })
// 路由器会创建一个 App 实例，并且挂载到选择符 #app 匹配的元素上。
const app = new Vue({
    store,
    router,
    render: h => h(App)
}).$mount('#app')
